﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.Util;
using ZLCMS.Data.Model;
using DotNet.Common.NHibernateUtil.QueryFilter;
using NHibernate;
using DotNet.Common.Command;
using ZLCMS.Commands.Sys.Commands.User;

namespace ZLCMS.Web.SystemManage.Basics.Shop.Agent
{
    public partial class SelectAgentDialog : System.Web.UI.Page
    {

        protected ZLCMS.Business.DwzFrame.FrameHelper _framePage;

        protected void Page_Load(object sender, EventArgs e)
        {
            _framePage = new ZLCMS.Business.DwzFrame.FrameHelper(this);

            name.Text = Request["name"];
            code.Text = Request["code"];
            ParamKit.Bind("Roles", role, null, new List<ListItem>() { ParamKit.ParamItemEx_QXZ() }, null,
                string.IsNullOrEmpty(Request["role"]) ? "-1" : Request["role"], "-1");

            LoadUserListParameter param = new LoadUserListParameter();
            param.PageSize = _framePage.IsAjaxPagerPostBack ? _framePage.PageSize : 20;
            param.PageIndex = _framePage.IsAjaxPagerPostBack ? _framePage.PageIndex : 1;
            param.UserName = Request["name"];
            param.RoleCode = Request["role"];
            param.UserCode = Request["code"];

            ICommandResult<LoadUserListResult> result = new LoadUserListCommand().Execute(param);
            if (!result.Error)
            {
                _framePage.RecordCount = result.TotalCount;
                repeater1.DataSource = result.Result.List;
                repeater1.DataBind();
            }
        }
    }
}